﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "Heal", menuName = "gameplay/skills/Heal")]

public class Heal : Skill
{
    public override void Cast()
    {
        base.Cast();
        TargetChooser.ChooseInTeam(user.team);
    }

    public override void Effect()
    {
        base.Effect();
        TakeHeal(this.GetSkillDamage());
    }

    public override int GetSkillDamage()
    {
        return (int)(user.data.attack * user.attackRate);
    }

    public override bool CastAble()
    {
        return base.CastAble();
    }

    public void TakeHeal(float healValue)
    {
        if (!target.alive) return;
        if (target.currentHp + healValue >= target.data.maxHp)
        {
            target.currentHp = target.data.maxHp;
        }
        else
        {
            target.currentHp += healValue;
        }
    }
}
